/// @tags: SegmentTree
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin;
using std::cout;
using std::endl;

namespace BlueQuantum {

constexpr int maxn = 5e5 + 1, maxnode = maxn * 4;

int n, q;

struct Point {
  double x, y;
  Point operator+(const Point& rhs) const {
    return Point{x + rhs.x, y + rhs.y};
  }
} p[maxn];

/* |a b|
   |c d| */
struct Matrix {
  double a, b, c, d;
  Point operator*(const Point& rhs) const {
    return Point{a * rhs.x + b * rhs.y, c * rhs.x + d * rhs.y};
  }
  Matrix operator*(const Matrix& rhs) const {
    return Matrix{a * rhs.a + b * rhs.c, a * rhs.b + b * rhs.d,
                  c * rhs.a + d * rhs.c, c * rhs.b + d * rhs.d};
  }
};

struct Node {
  Point tagp;
  Matrix tagmat;
  bool tag;
  double x, y, x2, y2, xy;
} tr[maxnode];

void pushup(int u) {
  int ls = u << 1, rs = u << 1 | 1;
  tr[u].x = tr[ls].x + tr[rs].x;
  tr[u].y = tr[ls].y + tr[rs].y;
  tr[u].x2 = tr[ls].x2 + tr[rs].x2;
  tr[u].y2 = tr[ls].y2 + tr[rs].y2;
  tr[u].xy = tr[ls].xy + tr[rs].xy;
}

void pushdown(int u, int l, int r) {
  if (tr[u].tag) {
    int ls = u << 1, rs = u << 1 | 1, mid = (l + r) / 2;
    // Multiply
    Node tmp = tr[ls];
    tr[ls].x = tr[u].tagmat.a * tmp.x + tr[u].tagmat.b * tmp.y;
    tr[ls].y = tr[u].tagmat.c * tmp.x + tr[u].tagmat.d * tmp.y;
    tr[ls].x2 = tr[u].tagmat.a * tr[u].tagmat.a * tmp.x2 +
                2 * tr[u].tagmat.a * tr[u].tagmat.b * tmp.xy +
                tr[u].tagmat.b * tr[u].tagmat.b * tmp.y2;
    tr[ls].y2 = tr[u].tagmat.c * tr[u].tagmat.c * tmp.x2 +
                2 * tr[u].tagmat.c * tr[u].tagmat.d * tmp.xy +
                tr[u].tagmat.d * tr[u].tagmat.d * tmp.y2;
    tr[ls].xy =
        (tr[u].tagmat.b * tr[u].tagmat.c + tr[u].tagmat.a * tr[u].tagmat.d) *
            tmp.xy +
        tr[u].tagmat.a * tr[u].tagmat.c * tmp.x2 +
        tr[u].tagmat.b * tr[u].tagmat.d * tmp.y2;
    // Add
    tmp = tr[ls];
    tr[ls].x += tr[u].tagp.x * (mid - l + 1);
    tr[ls].y += tr[u].tagp.y * (mid - l + 1);
    tr[ls].x2 +=
        tr[u].tagp.x * tr[u].tagp.x * (mid - l + 1) + 2 * tmp.x * tr[u].tagp.x;
    tr[ls].y2 +=
        tr[u].tagp.y * tr[u].tagp.y * (mid - l + 1) + 2 * tmp.y * tr[u].tagp.y;
    tr[ls].xy += tr[u].tagp.x * tmp.y + tr[u].tagp.y * tmp.x +
                 (mid - l + 1) * tr[u].tagp.x * tr[u].tagp.y;

    // Multiply
    tmp = tr[rs];
    tr[rs].x = tr[u].tagmat.a * tmp.x + tr[u].tagmat.b * tmp.y;
    tr[rs].y = tr[u].tagmat.c * tmp.x + tr[u].tagmat.d * tmp.y;

    tr[rs].x2 = tr[u].tagmat.a * tr[u].tagmat.a * tmp.x2 +
                2 * tr[u].tagmat.a * tr[u].tagmat.b * tmp.xy +
                tr[u].tagmat.b * tr[u].tagmat.b * tmp.y2;
    tr[rs].y2 = tr[u].tagmat.c * tr[u].tagmat.c * tmp.x2 +
                2 * tr[u].tagmat.c * tr[u].tagmat.d * tmp.xy +
                tr[u].tagmat.d * tr[u].tagmat.d * tmp.y2;
    tr[rs].xy =
        (tr[u].tagmat.b * tr[u].tagmat.c + tr[u].tagmat.a * tr[u].tagmat.d) *
            tmp.xy +
        tr[u].tagmat.a * tr[u].tagmat.c * tmp.x2 +
        tr[u].tagmat.b * tr[u].tagmat.d * tmp.y2;
    // Add
    tmp = tr[rs];
    tr[rs].x += tr[u].tagp.x * (r - mid);
    tr[rs].y += tr[u].tagp.y * (r - mid);
    tr[rs].x2 +=
        tr[u].tagp.x * tr[u].tagp.x * (r - mid) + 2 * tmp.x * tr[u].tagp.x;
    tr[rs].y2 +=
        tr[u].tagp.y * tr[u].tagp.y * (r - mid) + 2 * tmp.y * tr[u].tagp.y;
    tr[rs].xy += tr[u].tagp.x * tmp.y + tr[u].tagp.y * tmp.x +
                 (r - mid) * tr[u].tagp.x * tr[u].tagp.y;

    tr[ls].tagmat = tr[u].tagmat * tr[ls].tagmat;
    tr[rs].tagmat = tr[u].tagmat * tr[rs].tagmat;
    tr[ls].tagp = tr[u].tagmat * tr[ls].tagp + tr[u].tagp;
    tr[rs].tagp = tr[u].tagmat * tr[rs].tagp + tr[u].tagp;

    tr[u].tagmat = Matrix{1, 0, 0, 1};
    tr[u].tagp = Point{0, 0};
    tr[u].tag = false;
    tr[ls].tag = tr[rs].tag = true;
  }
}

void build(int u, int l, int r) {
  tr[u].tagmat = Matrix{1, 0, 0, 1};
  if (l == r) {
    tr[u].x = p[l].x, tr[u].y = p[l].y, tr[u].x2 = p[l].x * p[l].x,
    tr[u].y2 = p[l].y * p[l].y, tr[u].xy = p[l].x * p[l].y;
    return;
  }
  int mid = (l + r) >> 1;
  build(u << 1, l, mid), build(u << 1 | 1, mid + 1, r);
  pushup(u);
}

void addMat(int u, int l, int r, int L, int R, double x, double y) {
  if (L <= l && r <= R) {
    tr[u].tag = true;
    tr[u].tagp.x += x, tr[u].tagp.y += y;
    tr[u].x2 += x * x * (r - l + 1) + 2 * x * tr[u].x;
    tr[u].y2 += y * y * (r - l + 1) + 2 * y * tr[u].y;
    tr[u].xy += x * tr[u].y + y * tr[u].x + x * y * (r - l + 1);
    tr[u].x += x * (r - l + 1);
    tr[u].y += y * (r - l + 1);
    return;
  }
  int mid = (l + r) >> 1;
  if (tr[u].tag) pushdown(u, l, r);
  if (L <= mid) addMat(u << 1, l, mid, L, R, x, y);
  if (mid < R) addMat(u << 1 | 1, mid + 1, r, L, R, x, y);
  pushup(u);
}

/**
 * x' = ax + by
 * y' = cx + dy
 */
void multiplyMat(int u, int l, int r, int L, int R, Matrix mat) {
  if (L <= l && r <= R) {
    Node tmp = tr[u];
    tr[u].x = mat.a * tmp.x + mat.b * tmp.y;
    tr[u].y = mat.c * tmp.x + mat.d * tmp.y;
    tr[u].x2 = mat.a * mat.a * tmp.x2 + 2 * mat.a * mat.b * tmp.xy +
               mat.b * mat.b * tmp.y2;
    tr[u].y2 = mat.c * mat.c * tmp.x2 + 2 * mat.c * mat.d * tmp.xy +
               mat.d * mat.d * tmp.y2;
    tr[u].xy = (mat.b * mat.c + mat.a * mat.d) * tmp.xy +
               mat.a * mat.c * tmp.x2 + mat.b * mat.d * tmp.y2;
    tr[u].tag = true;
    tr[u].tagmat = mat * tr[u].tagmat;
    tr[u].tagp = mat * tr[u].tagp;
    return;
  }
  int mid = (l + r) >> 1;
  if (tr[u].tag) pushdown(u, l, r);
  if (L <= mid) multiplyMat(u << 1, l, mid, L, R, mat);
  if (mid < R) multiplyMat(u << 1 | 1, mid + 1, r, L, R, mat);
  pushup(u);
}

template <class Ty1, class Ty2>
const std::pair<Ty1, Ty2> operator+(const std::pair<Ty1, Ty2>& lhs,
                                    const std::pair<Ty1, Ty2>& rhs) {
  return {lhs.first + rhs.first, lhs.second + rhs.second};
}

std::pair<double, double> querySum(int u, int l, int r, int L, int R) {
  if (L <= l && r <= R) return std::make_pair(tr[u].x, tr[u].y);
  int mid = (l + r) >> 1;
  std::pair<double, double> ans = {0, 0};
  if (tr[u].tag) pushdown(u, l, r);
  if (L <= mid) ans = ans + querySum(u << 1, l, mid, L, R);
  if (mid < R) ans = ans + querySum(u << 1 | 1, mid + 1, r, L, R);
  return ans;
}

std::pair<double, double> querySumSqr(int u, int l, int r, int L, int R) {
  if (L <= l && r <= R) return std::make_pair(tr[u].x2, tr[u].y2);
  int mid = (l + r) >> 1;
  std::pair<double, double> ans = {0, 0};
  if (tr[u].tag) pushdown(u, l, r);
  if (L <= mid) ans = ans + querySumSqr(u << 1, l, mid, L, R);
  if (mid < R) ans = ans + querySumSqr(u << 1 | 1, mid + 1, r, L, R);
  return ans;
}

int main() {
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) {
    cin >> p[i].x >> p[i].y;
  }
  build(1, 1, n);
  while (q--) {
    int opt, l, r;
    double theta, a, b, lambda, y;
    std::pair<double, double> sum, sqr;
    cin >> opt;
    switch (opt) {
      case 1:
        cin >> l >> r >> a >> b;
        addMat(1, 1, n, l, r, a, b);
        break;
      case 2:
        cin >> l >> r >> a >> b >> theta;
        addMat(1, 1, n, l, r, -a, -b);
        multiplyMat(1, 1, n, l, r,
                    Matrix{cos(theta), -sin(theta), sin(theta), cos(theta)});
        addMat(1, 1, n, l, r, a, b);
        break;
      case 3:
        cin >> l >> r >> a >> b >> lambda;
        addMat(1, 1, n, l, r, -a, -b);
        multiplyMat(1, 1, n, l, r, Matrix{lambda, 0, 0, lambda});
        addMat(1, 1, n, l, r, a, b);
        break;
      case 4:
        cin >> l >> r >> theta >> y;
        addMat(1, 1, n, l, r, 0, -y);
        multiplyMat(
            1, 1, n, l, r,
            Matrix{cos(-theta), -sin(-theta), sin(-theta), cos(-theta)});
        multiplyMat(1, 1, n, l, r, Matrix{1, 0, 0, -1});
        multiplyMat(1, 1, n, l, r,
                    Matrix{cos(theta), -sin(theta), sin(theta), cos(theta)});
        addMat(1, 1, n, l, r, 0, y);
        break;
      case 5:
        cin >> l >> r >> theta >> y;
        addMat(1, 1, n, l, r, 0, -y);
        multiplyMat(
            1, 1, n, l, r,
            Matrix{cos(-theta), -sin(-theta), sin(-theta), cos(-theta)});
        multiplyMat(1, 1, n, l, r, Matrix{1, 0, 0, 0});
        multiplyMat(1, 1, n, l, r,
                    Matrix{cos(theta), -sin(theta), sin(theta), cos(theta)});
        addMat(1, 1, n, l, r, 0, y);
        break;
      case 6:
        cin >> l >> r;
        sum = querySum(1, 1, n, l, r);
        cout << sum.first / (r - l + 1) << ' ' << sum.second / (r - l + 1)
             << '\n';
        break;
      case 7:
        cin >> l >> r >> a >> b;
        sum = querySum(1, 1, n, l, r);
        sqr = querySumSqr(1, 1, n, l, r);
        cout << sqr.first - 2 * sum.first * a + a * a * (r - l + 1) +
                    sqr.second - 2 * sum.second * b + b * b * (r - l + 1)
             << '\n';
        break;
    }
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("External.in", "r", stdin);
  freopen("External.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
